package com.visualexpress.predict;

import com.visualexpress.dao.LocationAvertimeDAO;
import com.visualexpress.domain.Location;
import com.visualexpress.domain.LocationAvertime;

public class GetAverageTimeForCity {
	public static double getAverageTimeForCity(Location city) {
		LocationAvertimeDAO locAverTimeDAO = new LocationAvertimeDAO();
		LocationAvertime locAverTime;
		locAverTime = locAverTimeDAO.findByLocation(city);
		
		if(locAverTime == null) {
			return -1.0;
		} else {
			return locAverTime.getTimeStay();
		}
	}
}
